<template>
  <div class="new-detail">
    <div class="news-content" v-for="item in newsList" :key="item.id">
      <h3 class="new-title">{{item.title}}</h3>
      <div class="new-info">
        <span>发表时间：{{item.add_time|dateFormat}}</span>
        <span>点击次数：{{item.click}}</span>
      </div>
      <div class="content" v-html="item.content"></div>
      <!-- 评论 -->
      <my-commet></my-commet>
    </div>
  </div>
</template>

<script>
import Comment from './comment/Comment'
export default {
  data() {
    return {
      newsList: [],
      id: this.$route.params.id
    }
  },
  components: {
    'my-commet': Comment
  },
  created() {
    this.getnewsList()
  },
  methods: {
    async getnewsList() {
      const { data: res } = await this.$http.get('/api/getnew/' + this.id)

      this.newsList = res.message
    }
  }
}
</script>

<style lang="less" scoped>
.new-detail {
  padding: 0 10px;
  .new-title {
    font-size: 14px;
    color: #1989fa;
    text-align: center;
    margin: 0;
    padding: 5px 0;
  }
  .new-info {
    font-size: 13px;
    color: #1989fa;
    padding: 5px 0;
    border-bottom: 1px solid #ccc;
    display: flex;
    justify-content: space-between;
  }
  .content p {
    color: #535353;
  }
}
</style>
